import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        /**
         * 是否需要强制登录
         */
        forcedLogin: false,
        hasLogin: false,
        userName: "",
		checkItem: {
			
		},
		sampleItem: {},
		sampleName: {},
		samplingStandard: {}
    },
    mutations: {
        login(state, userName) {
            state.userName = userName || '新用户';
            state.hasLogin = true;
        },
        logout(state) {
            state.userName = "";
            state.hasLogin = false;
        },
		setCheckItem(state, data){
			console.log(data);
			state.checkItem = data;
		},
		setSampleItem(state, data){
			console.log(data);
			state.sampleItem = data;
		},
		setSampleName(state, data){
			console.log(data);
			state.userList = data;
		},
		setSamplingStandard(state, data){
			console.log(data);
			state.userList = data;
		},
    },
	actions: {
		commitCheckItem ({commit}, data) {
			commit('setCheckItem', data);
		},
		commitSampleItem ({commit}, data) {
			commit('setSampleItem', data);
		},
		commitSampleName ({commit}, data) {
			commit('setSampleName', data);
		},
		commitSamplingStandard ({commit}, data) {
			commit('samplingStandard', data);
		},
	}
})

export default store
